package com.mrt.chatgpt.data.trigger.http;

import com.mrt.chatgpt.data.domain.order.model.entity.PayOrderEntity;
import com.mrt.chatgpt.data.domain.order.model.entity.ShopCartEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author 86135
 * @Date 2024/3/28 9:31
 * @Description
 * @Version 1.0
 * @快捷键 getterANDsetter ALT+Insert
 * @快捷键 Ctrl+/或者Ctrl+Shift+/都可以快速注释
 * @快捷键 Ctrl+D 快速复制代码
 * @“ctrl+r”快捷键,用于当前文件内容替换,指的是在当前打开的文件中替换匹配的字符,只操作一个文件;
 * @ALT+鼠标左键 整列编辑
 * @快捷键提示 ALT+Enter
 * @快捷键 快速写注释：在方法函数上方输入/** 然后回车
 * @快捷键 Ctrl+O，选择重写的方法
 * @快捷键 ALT+INSERT
 */

@Controller
public class TestController {
    @RequestMapping("/test")
    public String createParOrder(Model model) {
        String form = "<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=jlEKzE78uQlYoZWWr3uS8iqxzig7JOPAZTUIksQzLLqcIw%2BwXMbiKITfs7grihcH1pk6AquDFzGOWvW4udxJLhQehfD3jQOt3KvQ35FgzRHcqUoKPrd1k5%2F4ZtNdHC%2FwLwiGRvUkpsiXMe2IaU5bg15URIdOQw3n2ImH3wro3pvIe1dY1wH3AmeglS%2Bgvlr6nui7SiDcQy77D1K9Mkj0wwPJswR9Fl1opQMza72h2MthMD02MMZNKoBFXEPMG3A4w6lCq76A2h1OWOgsrHBlbtb1LuzbHj2FxgwO0SkCVR1G7pXTunKW63f%2BO4GPE8eymj%2FJpSYiOhEpI%2B6J14tNJw%3D%3D&return_url=https%3A%2F%2Fgaga.plus&notify_url=http%3A%2F%2Fmrtchat.natapp1.cc%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000135666034&sign_type=RSA2&timestamp=2024-03-28+09%3A43%3A58&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n" +
                "  <input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;daniel82AAAA000032233361X04&quot;,&quot;total_amount&quot;:&quot;0.01&quot;,&quot;subject&quot;:&quot;测试商品&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n" +
                "  <input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n" +
                "</form>\n" +
                "<script>document.forms[0].submit();</script>";

        model.addAttribute("formContent", form);

        // 返回自定义HTML页面路径
        return "redirect:templates/your_custom_page.html";
    }

}
//@Controller
//public class TestController {
//    @RequestMapping("/test")
//    public String createParOrder(Model model, HttpServletResponse response) {
//        String redirectUrl = "redirect:https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=jlEKzE78uQlYoZWWr3uS8iqxzig7JOPAZTUIksQzLLqcIw%2BwXMbiKITfs7grihcH1pk6AquDFzGOWvW4udxJLhQehfD3jQOt3KvQ35FgzRHcqUoKPrd1k5%2F4ZtNdHC%2FwLwiGRvUkpsiXMe2IaU5bg15URIdOQw3n2ImH3wro3pvIe1dY1wH3AmeglS%2Bgvlr6nui7SiDcQy77D1K9Mkj0wwPJswR9Fl1opQMza72h2MthMD02MMZNKoBFXEPMG3A4w6lCq76A2h1OWOgsrHBlbtb1LuzbHj2FxgwO0SkCVR1G7pXTunKW63f%2BO4GPE8eymj%2FJpSYiOhEpI%2B6J14tNJw%3D%3D&return_url=https%3A%2F%2Fgaga.plus&notify_url=http%3A%2F%2Fmrtchat.natapp1.cc%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000135666034&sign_type=RSA2&timestamp=2024-03-28+09%3A43%3A58&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json";
//
//        // 使用重定向
//        return "redirect:" + redirectUrl;
//    }
//}
